import { createNaiveStorage } from 'naive-storage'
import { BaseStorage, getLsKey } from './base'
import { STORAGE_TOKEN_KEY } from '@/constants/ls'

const storage = createNaiveStorage<string>({
    debug: process.env.NODE_ENV !== 'production',
    storage: BaseStorage
})
const KEY = getLsKey(STORAGE_TOKEN_KEY)
export function setStorageToken(token: string) {
    storage.set(KEY, token)
}
export function getStorageToken() {
    return storage.get(KEY)
}
export function removeStorageToken() {
    storage.del(KEY)
}

